#!/bin/sh
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
config etc/rc.d/rc.oss.new

# If OSSv4 is found, we delete its modules.  Why? Because they have to be
# upgraded for each upgrade of the kernel, but also everytime you upgrade OSS or
# they won't be built again by default.  Normally, this is only necessary when
# you install a new version of OSS, but deleting all the modules everytime this
# package is installed is the safest approach, IMHO. /etc/rc.d/rc.oss will
# launch the script to compile that again.
if [ -f lib/modules/$(uname -r)/kernel/oss/vmix.ko ]; then
  rm -rf lib/modules/$(uname -r)/kernel/oss
fi

